package com.mls.guardian.remoting.client.impl;

import com.mls.guardian.remoting.client.ClientConnect;
import io.netty.channel.Channel;

/**
 * Created by jl on 15/10/23.
 */
public class NettyClientConnect implements ClientConnect {
    private Channel channel;

    public NettyClientConnect(Channel channel){
        this.channel = channel;
    }

    @Override
    public Channel getConnect() {
        return this.channel;
    }

    @Override
    public void setConnect(Object channel) {
        this.channel = (Channel) channel;
    }

    @Override
    public boolean equals(ClientConnect clientConnect) {
        Channel channelOther = (Channel) clientConnect.getConnect();
        return channel.remoteAddress().equals(channelOther.remoteAddress());
    }


}
